import Editor from '../editor';
import { Operation } from './operation'
import { InsertTextOperation } from './insert_text_operation'
export class DeleteTextOperation implements Operation {
  spacers_!: string
  endIndex
  startIndex
  constructor(startIndex: number, endIndex: number) {
    this.endIndex = endIndex
    this.startIndex = startIndex
  }
  getSpacers(): string {
    return '';
  }
  setSpacers(spacers: string): void {}
  apply(editor: Editor): void {
    // editor.getTextModel()
    // this.spacers_ = editor.getTextModel().getSpacers().slice(this.startIndex, this.endIndex)
   
    editor.getTextModel().delete(this.startIndex, this.endIndex)
  }
  reverse() {
    return new InsertTextOperation(this.spacers_, this.startIndex)
  }

}